<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 除了将对象本身冻结，对象的属性也应该冻结。下面是一个将对象彻底冻结的函数。
        var constantize = (obj) => {
            Object.freeze(obj);
            Object.keys(obj).forEach((key, i) => {
                if (typeof obj[key] === 'object') {
                    constantize(obj[key]);
                }
            });
        };
        

    </script>
</body>

</html>